package reflect;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import reflect.annotations.AutoRunClass;

import java.io.File;
import java.net.URISyntaxException;

public class Test3 {
    public static void main(String[] args) throws Exception {
        File dir = new File(
                Test3.class.getResource(".").toURI()
        );
        File[] files = dir.listFiles(f -> f.getName().endsWith(".class"));// 判断一下是否以.class字节码文件结尾
        for (File file: files){
            String packageName =Test3.class.getPackage().getName();
          String className = file.getName().replace(".class", "");
          Class cls = Class.forName(packageName + "." + className);
          if (cls.isAnnotationPresent(AutoRunClass.class)){
              Object obj = cls.newInstance();
              System.out.println(obj);
          }

        }





    }

}
